<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>北妇患者登记小票</title>
    <link rel="stylesheet" href="/print/_css/bf_patientregister.css" />
  </head>
  <body>
    <div id="app">
      <div class="title">{{ dataInfo.deptName }}</div>
      <div>【医生：{{ dataInfo.doctorName }}】</div>
      <div>
        上午&nbsp;排队号：<span class="jiachu">{{ dataInfo.sourceCode }}</span>
        号
      </div>
      <div>凭此号码诊病过时作废</div>
      <div>姓名：{{ dataInfo.patientName }}</div>
      <div>
        该医生在您之前还有<span class="jiachu">{{ dataInfo.waitNum }}</span
        >位候诊
      </div>
      <div>请耐心等待，注意屏幕提示</div>
      <div class="flex-box">
        <div class="left">
          <img class="ercode" src="/img/bfwxlogo.png" alt="" />
        </div>
        <div class="right">
          <div>扫描二维码，关注本院小程序</div>
          <div>打印时间：{{ time | toTime }}</div>
        </div>
      </div>
    </div>
    <script src="https://lib.baomitu.com/vue/2.6.10/vue.min.js"></script>
    <script>
      new Vue({
        data: {
          dataInfo: {},
          time: new Date()
        },
        filters: {
          toTime(time) {
            // let time=new Date();
            return (
              time.getFullYear() +
              "/" +
              (time.getMonth() + 1) +
              "/" +
              time.getDate() +
              " " +
              time.getHours() +
              ":" +
              time.getMinutes() +
              ":" +
              time.getSeconds()
            );
          }
        },
        mounted() {
          var th = this;
          window.addEventListener("message", function(e) {
            th.dataInfo = e.data;
            th.$nextTick(function() {
              window.print();
            });
          });
        }
      }).$mount("#app");
    </script>
  </body>
</html>
